<template>
  <view class="content">
    <image class="logo" src="/static/logo.png"></image>
    <view class="text-area">
      <text class="title">{{ title }}</text>

      <input class="username" type="text" name="" v-model="loginPar.username" />
      <input class="username" type="text" name="" v-model="loginPar.password" />
      <button @click="login">登录</button>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import md5 from "md5";
import { useUserStore } from "../../store/modules/user";

const title = ref("你好");
const userStore = useUserStore();
const loginPar = {
  username: "sq",
  password: "987654",
};

const login = async () => {
  console.log("555");
  const par = {
    ...loginPar,
    password: md5(loginPar.password),
  };
  await userStore.login(par);
};
</script>

<style>
@import url("./index.less");
</style>
